<?php if ($this->session->userdata('grupo') !== "Usuários") { ?>
  <a href="<?php echo base_url('processos/cadastro') ?>" class="btn btn-add"><i class="icon-plus"></i> Novo processo</a>
<?php } ?>

<?php if (count($processos)) { ?>
  <table class="table table-bordered table-hover table-striped">
    <colgroup>
      <col width="26%" />
      <col width="17%" />
      <col width="31%" />
      <col width="26%" />
    </colgroup>

    <thead>
      <tr>
        <th>Processo</th>
        <th>Nº de Ordem</th>
        <th>Requerente(s)</th>
        <th>Requerido</th>
      </tr>
    </thead>

    <tbody>
      <?php foreach ($processos as $p) { ?>
        <?php $p->nome_requerente = explode(',', $p->nome_requerente) ?>
        <tr>
          <td><a href="<?php echo base_url('processos/cadastro/'.md5('MB'.$p->id.'SG')) ?>"><?php echo $p->numero ?></a></td>
          <td><a href="<?php echo base_url('processos/cadastro/'.md5('MB'.$p->id.'SG')) ?>"><?php echo $p->ordem ?></a></td>
          <td><a href="<?php echo base_url('processos/cadastro/'.md5('MB'.$p->id.'SG')) ?>">
            <?php
            echo $p->nome_requerente[0];
            $count = count($p->nome_requerente);
            if ($count > 1) {
              echo '<div class="badge badge-inverse" rel="tooltip" title="';
              for ($i = 0; $i < $count; $i++)
                echo $i ? $p->nome_requerente[$i] . '<br />' : '';
              $count--;
              echo '">+'.$count.'</div>';
            }
            ?>
          </a></td>
          <td><a href="<?php echo base_url('processos/cadastro/'.md5('MB'.$p->id.'SG')) ?>"><?php echo $p->nome_requerido ?></a></td>
        </tr>
      <?php } ?>
    </tbody>
  </table>
<?php } else { ?>
  <p class="well well-small"><i class="icon-exclamation-sign icon-large"></i> Não existem processos cadastrados.</p>
<?php } ?>